angular.module('guideApp', [])
    .controller('guideCtrl', ['$scope', '$location', '$timeout','$interval', function ($scope, $location, $timeout,$interval) {
        $scope.timer=null;
        $scope.myArr = ['./src/image/guide.png', './src/image/start.png', './src/image/guide.png'];
        $scope.index = 0;
        $scope.spotFn = function (x) {
            $scope.index=x;
        };
        $scope.autoFu=function(){
            if($scope.timer){
                $interval.cancel($scope.timer)
            }
            $scope.timer=$interval(function () {
                $scope.index++;
                if($scope.index==($scope.myArr).length){
                    $location.path('/home')
                }
            },2000)
        };
        $scope.autoFu();
        $scope.title = 'guide page controller';
        $scope.clickFn = function () {
            $timeout(function () {
                $location.path('/home');
            }, 1000)
        }
    }]);